package cn.it62.pojo;

/**
 * @author zhenhuaShen
 * @version 1.0
 * @date 2019/7/31
 * @description cn.it62.pojo
 */


public class Helicopter extends Aircraft {
    private int manned;
    private String troops;
    /**
     * 有参构造
     *
     * @param planeName
     * @param oil
     * @param voyage
     * @param manned
     * @param troops
     */
    public Helicopter(String planeName, int oil, int voyage, int manned, String troops) {
        super(planeName, oil, voyage);
        setManned(manned);
        setTroops(troops);
    }

    public int getManned() {
        return manned;
    }

    public void setManned(int manned) {
        if (manned < 4) {
            System.out.println("载人数至少为4");
            manned = 4;
        }
        this.manned = manned;
    }

    public String getTroops() {
        return troops;
    }

    public void setTroops(String troops) {
        this.troops = troops;
    }

    /**
     * transportation表示运输部队功能
     */
    public void transportation() {
        System.out.println(getPlaneName() + "可以运输部队");
    }
    /**
     * attack表示对地攻击功能
     */
    public void attack() {
        System.out.println(getPlaneName() + "可以对地攻击");
    }

    public String toString() {
        return "Helicopter{" +
                "planeName='" + getPlaneName() + '\'' +
                ", oil=" + getOil() +
                ", voyage=" + getVoyage() +
                ",manned=" + manned +
                ", troops='" + troops + '\'' +
                '}';
    }
}
